1. Field of the Invention
The present invention relates to a programmable controller having a loading feature that changes control information such as control programs.
2. Description of the Prior Art
FIG. 1 is a block diagram of the conventional programmable controller disclosed in Japanese Patent Application Laid-Open No. 2-125360. In FIG. 1, reference numeral 1 designates a maintenance tool used to develop and maintain control information such as control programs, control data and a start management table necessary for executing a programmable controller 2; and numeral 1a designates a hard disk unit that contains the control information. Each programmable controller 2 has a main memory 3 which in turn comprises a program ID management table 3a, a start management table storage area 3b, a control program storage area 3c and a control data storage area 3d. The program ID management table 3a stores management information about the state of control program execution as well as the addresses of the areas holding the control information, i.e., addresses of the start management table storage area 3b, the control program storage area 3c and the control data storage area 3d. The start management table storage area 3b stores conditions for starting control programs. The control program storage area 3c stores the control programs. The control data storage area 3d stores the control data for the control programs. Also in FIG. 1, numeral 4 designates a change request monitoring unit that checks to see if any new control information is output from the maintenance tool 1 and, if such new control information is received, notifies a scheduler unit 8 thereof. Numeral 5 designates a load execution unit that accepts new control information from the maintenance tool 1 and, upon receipt of an execution command from the scheduler unit 8, loads the new control information into the area designated by the addresses stored in the program ID management table 3a. Numeral 6 designates a start condition monitoring unit that searches for an executable control program based on the management information stored in the program ID management table 3a, checks the start management table storage area 3b for the condition for starting the executable control program, and supplies the scheduler unit 8 with a program start command to start that program if the condition for starting it has been met. Numeral 7 designates a control program execution unit that executes the control program when receiving the start command therefor from the scheduler unit 8. Numeral 8 designates the scheduler unit that controls the load execution unit 5 and control program execution unit 7. Numeral 9 designates an object device to be controlled by the control program execution unit 7. Numeral 10 designates a system bus that connects a plurality of programmable controllers 2.
How each programmable controller of FIG. 1 works will now be described with reference to the flowchart of FIG. 2. In step ST1, the change request monitoring unit detects new control information from the maintenance tool 1. In step ST2, the change request monitoring unit 4 notifies the scheduler 8 of the detection of the new control information, and the load execution unit 5 accepts that information. In step ST3, the scheduler unit 8 starts the load execution unit 5 by carrying out a scheduling procedure, to be described later with reference to FIG. 3. In step ST4, the load execution unit 5 checks to see if the control program to be changed is executing or executable in accordance with the management information in the program ID management table 3a. If the control program to be changed is found to be executing or executable (see program ID's "A" through "C" in FIG. 4), step ST5 is reached. In step ST5, the control program in question is stopped by rewriting into stopped state the content of the management information in the program ID management table 3a. In step ST6, the load execution unit 5 loads the new control information into the area indicated by the addresses placed in the program ID management table (e.g., addresses pointing to control program 1000, control data 2000 and start management table 800 if the program to be changed is A). In step ST7, the content of the management information is rendered executable. This completes the whole controller operation.
How the scheduler unit 8 performs its scheduling will now be described with reference to the flowchart of FIG. 3. In step ST11, the start condition monitoring unit 6 checks the start management table 3b for the condition for starting the executable control program and, every time the applicable starting condition is met, outputs a control program start command to the scheduler unit 8. In step ST12, the maintenance tool 1 outputs new control information. In turn, after detecting this new control information (step ST13), the change request monitoring unit 4 outputs a load execution unit start command to the scheduler unit 8. In step ST14, the scheduler unit 8 checks to see if it has received a control program start command from the start condition monitoring unit 6. If it has, the scheduler unit 8 goes to step ST15 and checks to see if the load execution unit 5 is operating. If the load execution unit 5 is found to be operating, step ST16 is reached in which the load execution unit 5 is stopped. In step ST17, the control program execution unit 7 is executed. If it is found in step ST14 that the scheduler unit 8 has not received a control program start command from the start condition monitoring unit 6, step ST18 is reached In step ST18, a check is made to see if the load execution unit 5 has received a load execution instruction. If the load execution unit 5 is found to have received such instruction in step ST18, step ST19 is reached in which the unit 5 is operated or re-operated after interruption. That is, the scheduler unit while performing its scheduling executes the control program execution unit 7 in precedence over the load execution unit 5.
FIG. 4 is a typical structure of the program ID management table 3a. In FIG. 4, the program ID management table 3a illustratively contains, and not limited to, five program ID's. One program ID is composed of program ID execution state (management information) and a start address list. The execution state is any of "executing," "executable," "stopped" and "undefined." One start address list illustratively comprises a control program start address, a control data start address and a start management table start address. Initially, the execution state is "undefined" and the start address list has appropriate start addresses already set thereto.
FIG. 5 is a typical structure of the start management table 3b allocated to each program ID. A start management table illustratively contains a start cycle and pre-execution program ID's. A start cycle designates time intervals at which to start the applicable control program. A pre-execution program ID specifies that the applicable control program is to be started when execution of a certain program is completed.
The prior art programmable controller of the above-described construction is required to stop the currently executing or executable control program when a request is made to replace the current control information with new information. In particular, the prior art programmable controller requires the object device under its control to be stopped while the information is being replaced.